package com.citycloud.ccuap.tc.yq.dimensionbustype;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;

import com.citycloud.ccuap.commons.db.SqlRestrictions;

@Mapper
public interface SysDimensionBustypeMapper {

	@SelectProvider(type = SqlProvider.class, method = "findBusTypesByDatagroupId")
	public List<Map<String,Object>> findBusTypesByDatagroupId(String datagroupId);

	class SqlProvider {
		public String findBusTypesByDatagroupId(String datagroupId) {
			String sql = "SELECT t1.obj_id as objId,"
					+ "t1.BUSTYPE_OBJ_ID as bustypeObjId, t1.dic_code_type as dicCodeType,"
					+ "t1.BUSTYPE_CONDITION as bustypeCondition,t1.BUSTYPE_DESC as  bustypeDesc,t1.bustype_descbak as  bustypeDescbak,"
					+ "t1.SPECIAL_TYPE as  specialType,t2.FORMAT_TYPE as formatType "
					+ "FROM sys_dimension_bustype t1 left outer join ap_t_meta_bus_type t2 on "
					+ "t1.bustype_obj_id=t2.OBJ_ID where 1=1 ";
			sql += SqlRestrictions.eq("t1.DATAGROUP_ID", datagroupId);
			return sql;
		}

	}

	
}
